package com.aal.model;

/**
 *
 * @author Hoang
 */
public class User {
    
    private String username = null;

    /**
     * Get the value of username
     *
     * @return the value of username
     */
    public String getUsername() {
        return username;
    }

    /**
     * Set the value of username
     *
     * @param username new value of username
     */
    public void setUsername(String username) {
        this.username = username;
    }

    private String password;

    /**
     * Set the value of password
     *
     * @param password new value of password
     */
    public void setPassword(String password) {
        this.password = password;
    }
    
    public boolean getLoginSuccessfully() {
        if (!loginOK()) {
            username = null;
            return false;
        }
        else
            return true;
    }
    
    CustomerManagement cm = new CustomerManagement();
    
    private boolean loginOK() {
        cm.setUsername(username);
        cm.setPassword(password);
        return cm.getLoginOk();
    }
    
    public com.aal.entity.Customer getCustomer() {
        if (username == null) return null;
        cm.setUsername(username);
        return cm.getCustomer();
    }
}
